import asyncio


class EasyCoroutine:
    def __init__(self, *functions):
        self.functions = functions

    async def run(self):
        tasks = []
        for func in self.functions:
            # 创建任务
            task = asyncio.create_task(func())
            tasks.append(task)

        # 等待所有任务完成
        await asyncio.gather(*tasks)


# 示例异步函数
async def async_func_1():
    await asyncio.sleep(2)
    print("Function 1: Hello, World!")


async def async_func_2():
    await asyncio.sleep(1)
    print("Function 2: Hello, World!")


async def async_func_3():
    await asyncio.sleep(3)
    print("Function 3: Hello, World!")


if __name__ == '__main__':
    easy_coroutine = EasyCoroutine(
        lambda: async_func_1(),
        lambda: async_func_2(),
        lambda: async_func_3()
    )

    # 运行异步任务
    asyncio.run(easy_coroutine.run())
